#include<bits/stdc++.h>
using namespace std;
mt19937 Rnd(time(0));
bool cmp(pair<int,int> a,pair<int,int> b)//make sure .second is positive
{
	return 1ll * a.first * b.second < 1ll * b.first * a.second;
}
typedef struct{
	pair<int,int> x;//x.second = k
	int key,ls,rs;
	long long sum,sk;
}Tree;
Tree t[500011];
int idx = 0;
void push_up(int p)
{
	t[p].sum = t[t[p].ls].sum + t[t[p].rs].sum + t[p].x.first,t[p].sk = t[t[p].ls].sk + t[t[p].rs].sk + t[p].x.second;
}
int New(pair<int,int> x)
{
	idx++;
	t[idx].x = x,t[idx].key = Rnd();
	push_up(idx);
	return idx;
}
int merge(int x,int y)
{
	if(!x || !y)
		return x | y;
	if(t[x].key < t[y].key)
		return t[x].rs = merge(t[x].rs,y),push_up(x),x;
	else
		return t[y].ls = merge(x,t[y].ls),push_up(y),y;
}
void split_s(int p,int& l,int& r)
{
	if(!p)
		return l = r = 0,void();
	if(t[p].ls)
		return r = p,split_s(t[p].ls,l,t[p].ls),push_up(p);
	else
		return l = p,r = t[p].rs,t[p].rs = 0,push_up(p);
}
void split_x(int p,pair<int,int> x,int& l,int& r)
{
	if(!p)
		return l = r = 0,void();
	if(cmp(t[p].x,x) || (!cmp(x,t[p].x) && t[p].x.second < x.second))
		return l = p,split_x(t[p].rs,x,t[p].rs,r),push_up(p);
	else
		return r = p,split_x(t[p].ls,x,l,t[p].ls),push_up(p);
}
pair<int,int> pos;
void Split(int p,long long m,int& l,int& r)
{
	if(!p)
		return l = r = 0,void();
	if(t[t[p].ls].sk + t[p].x.second >= m)
		return pos = t[p].x,r = p,Split(t[p].ls,m,l,t[p].ls),push_up(p);
	else
		return l = p,Split(t[p].rs,m - t[p].sk + t[t[p].rs].sk,t[p].rs,r),push_up(p);
}
int root = 0;
long long Sk,add;
pair<int,int> a[500011];
int id;
void Insert(pair<int,int> x)
{
	a[++id] = x;
	if(x.second == 0)
	{
		add += abs(x.first);
		return;
	}
	Sk += x.second;
	int m = New(x);
	int l = 0,r = 0;
	split_x(root,x,l,r);
	root = merge(l,merge(m,r));
}
void Del(pair<int,int> x)
{
	if(x.second == 0)
	{
		add -= abs(x.first);
		return;
	}
	Sk -= x.second;
	int m = 0,l = 0,r = 0;
	split_x(root,x,l,r);
	split_s(r,m,r);
	root = merge(l,r);
}
int n;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	freopen("love.in","r",stdin);
	freopen("love.out","w",stdout);
	cin >> n;
	while(n--)
	{
		int op;
		cin >> op;
		if(op == 1)
		{
			int f,t,b;
			cin >> f >> t >> b;
			if(t < 0)
				t *= -1,b *= -1;
			pair<int,int> x = {f * t + b,t};
			Insert(x);
		}else{
			int x;
			cin >> x;
			Del(a[x]);
		}
		int l,r;
		Split(root,(Sk + 1) / 2,l,r);
		double x = (double)pos.first / pos.second,res = add + t[l].sk * x - t[l].sum + t[r].sum - t[r].sk * x;
		root = merge(l,r);
		cout << fixed << setprecision(7) << res << "\n";
	}
	return 0;
}